import {config} from "../config"
const tips = {
    1: "抱歉出现了错误",
    1005: "APPkey没有",
    3000: "期刊不错"
}


class HTTP {
    request(params) {   //params 其实就是个对象 var params = {} 不确定的值
        wx.request({
            url:config.api_base_url +  params.url ,
            data:params.data,       
            appkey:config.appkey,  //已经确定
            method:params.method || "GET",
            header: {
                "content-type": "application/json",
                "appkey": config.appkey
            },
            success:(res) =>{
                params.success && params.success(res.data)
                console.log(params)
            }
            ,fail:(error) =>{
                wx.showToast({
                    title:error
                },1000)
            }
        })
    }
}

export {HTTP}